package exception;

public class TryCatchDemo {
    public static void main(String[] args) {
        System.out.println("程序开始了");
        try{
//            String str = null;
//            System.out.println(str.length());
//            String str = "abc";
//            System.out.println(str.charAt(5));
            String str = "123";
            System.out.println(Integer.parseInt(str));
            System.out.println("!!!");
        }/*catch (StringIndexOutOfBoundsException e){
            System.out.println("出现了字符串越界异常，并处理完毕了");
        }catch (NullPointerException e){
            System.out.println("出现了空指针，并处理完毕了");
        }*/catch (NullPointerException|StringIndexOutOfBoundsException e){
            System.out.println("出现了空指针或者下标越界异常，并且用相同的方式处理完毕了");
        }catch (Exception e){
            System.out.println("反正出了个错！");
        }
        System.out.println("程序结束了");
    }
}
